home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJLSR106.ARJ / SETBUF.C < prev    next >
C/C++ Source or Header  |  1992-03-02  |  914b  |  35 lines

  1. /* This is file SETBUF.C */
  2. /* This file may have been modified by DJ Delorie (Jan 1991).  If so,
  3. ** these modifications are Coyright (C) 1991 DJ Delorie, 24 Kirsten Ave,
  4. ** Rochester NH, 03867-2954, USA.
  5. */
  6.  
  7. /*
  8.  * Copyright (c) 1980 Regents of the University of California.
  9.  * All rights reserved.  The Berkeley software License Agreement
  10.  * specifies the terms and conditions for redistribution.
  11.  */
  12.  
  13. #if defined(LIBC_SCCS) && !defined(lint)
  14. static char sccsid[] = "@(#)setbuf.c    5.2 (Berkeley) 3/9/86";
  15. #endif LIBC_SCCS and not lint
  16.  
  17. #include    <stdio.h>
  18.  
  19. setbuf(iop, buf)
  20. register FILE *iop;
  21. char *buf;
  22. {
  23.     if (iop->_base != NULL && iop->_flag&_IOMYBUF)
  24.         free(iop->_base);
  25.     iop->_flag &= ~(_IOMYBUF|_IONBF|_IOLBF);
  26.     if ((iop->_base = buf) == NULL) {
  27.         iop->_flag |= _IONBF;
  28.         iop->_bufsiz = NULL;
  29.     } else {
  30.         iop->_ptr = iop->_base;
  31.         iop->_bufsiz = BUFSIZ;
  32.     }
  33.     iop->_cnt = 0;
  34. }
  35.